package com.xiaomi;

import com.xiaomi.dao.GoodsDao;
import com.xiaomi.pojo.Cart;
import com.xiaomi.service.CartService;
import com.xiaomi.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

/**
 * @ClassName test
 * @Author xiao宋
 * @Date 0:34  2022/10/5
 * @Version 1.0
 * @Description TODO
 */
@RunWith(SpringRunner.class)
@ContextConfiguration("classpath:spring/*.xml")
public class test {
    @Autowired
    UserService userService;
    @Autowired
    GoodsDao goodsDao;
    @Autowired
    CartService cartService;
    @Test
    public void test1(){
//        User ming = userService.findByUsername("song");
//        User ming1 = userService.findByUserAndPwd("ming", "123");
//        System.out.println(ming1);
//        for (Goods goods : goodsDao.findAll()) {
//            System.out.println(goods);
//        }

        List<Cart> list = cartService.getCarts(7);
        for (Cart cart : list) {
            System.out.println(cart);
        }
    }
}
